﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Data.SqlClient;
using EMS20.Entity;
using EMS20.IDataAccessLayer;
using EMS20.DALFactory;

namespace EMS20.BusinessLogicLayer
{
    /// <summary>
    /// BLL Layer For dbo.Menus.
    /// </summary>
    public class MenusBLLBase
    {
		#region ----------变量定义----------
		///<summary>
		///
		///</summary>
		public static readonly IMenusDataAccessLayer _dal=DataAccessFactory.Create_Menus();
		#endregion
		
		#region ----------构造函数----------
		/// <summary>
		/// 构造函数
		/// </summary>
		public MenusBLLBase()
		{
		}
		#endregion

        #region ----------函数定义----------
		#region 添加更新删除
		/// <summary>
		/// 向数据库中插入一条新记录。
		/// </summary>
		/// <param name="oMenusInfo">Menus??</param>
		/// <returns>新插入记录的编号</returns>
		public static int Create_MenusInsert(MenusEntity oMenusInfo)
		{
			// Validate input
			if (oMenusInfo == null)
				return 0;
			// Use the dal to insert a new record 
			return _dal.Create_MenusInsert(oMenusInfo);
		}
		/// <summary>
		/// 向数据库中插入一条新记录。带事务
		/// </summary>
		/// <param name="sp">事务对象</param>
		/// <param name="oMenusInfo">Menus实体</param>
		/// <returns>新插入记录的编号</returns>
		public static int Create_MenusInsert(SqlTransaction sp,MenusEntity oMenusInfo)
		{
			if (oMenusInfo == null)
				return 0;
			// Use the dal to insert a new record 
			return _dal.Create_MenusInsert(sp,oMenusInfo);
		}
		/// <summary>
		/// 向数据表Menus更新一条记录。
		/// </summary>
		/// <param name="oMenusInfo">oMenusInfo</param>
		/// <returns>影响的行数</returns>
		public  static void Create_MenusUpdate(MenusEntity oMenusInfo)
		{
            // Validate input
			if (oMenusInfo==null)
				return;
			// Use the dal to update a new record 
			_dal.Create_MenusUpdate(oMenusInfo);
		}
		/// <summary>
		/// 向数据表Menus更新一条记录。带事务
		/// </summary>
		/// <param name="sp">事务对象</param>
		/// <param name="oMenusInfo">oMenusInfo</param>
		/// <returns>影响的行数</returns>
		public static int Create_MenusUpdate(SqlTransaction sp,MenusEntity oMenusInfo)
		{
			// Validate input
			if (oMenusInfo==null)
				return 0;
			// Use the dal to update a new record 
			return _dal.Create_MenusUpdate(sp,oMenusInfo);
		}
		
		/// <summary>
		/// 删除数据表Menus中的一条记录
		/// </summary>
	    /// <param name="m_id">m_id</param>
		/// <returns>影响的行数</returns>
		public static int Create_MenusDelete(int m_id)
		{
			// Validate input
			if(m_id<0)
				return 0;
			return _dal.Create_MenusDelete(m_id);
		}
		/// <summary>
		/// 删除数据表Menus中的一条记录,带事务
		/// </summary>
		/// <param name="sp">事务对象</param>
	    /// <param name="m_id">m_id</param>
		/// <returns>影响的行数</returns>
		public static int Create_MenusDelete(SqlTransaction sp,int m_id)
		{
			// Validate input
			if(m_id<0)
				return 0;
			return _dal.Create_MenusDelete(sp,m_id);
		}
		#endregion
		
        /// <summary>
		/// 得到 menus 数据实体
		/// </summary>
		/// <param name="m_id">m_id</param>
		/// <returns>menus 数据实体</returns>
		public static MenusEntity Get_MenusEntity(int m_id)
		{
			// Validate input
			if(m_id<0)
				return null;

			// Use the dal to get a record 
			return _dal.Get_MenusEntity(m_id);
		}
		
		/// <summary>
		/// 得到数据表Menus所有记录
		/// </summary>
		/// <returns>实体集</returns>
		public static IList< MenusEntity> Get_MenusAll()
		{
			// Use the dal to get all records 
			return _dal.Get_MenusAll();
		}
			
		
		/// <summary>
        /// 检测是否存在根据主键
        /// </summary>
        /// <param name="m_id">m_id</param>
        /// <returns>是/否</returns>
		public static bool IsExistMenus(int m_id)
		{
			return _dal.IsExistMenus(m_id);
		}

        #endregion
		
		
    }
}

